/*    */ package com.chw.admin.customer;
/*    */ 
/*    */ import com.chw.utils.CommonFieldsUtil;
/*    */ import com.chw.utils.UUIDUtil;
/*    */ import com.github.pagehelper.PageHelper;
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import java.util.Date;
/*    */ import java.util.List;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Service;
/*    */ 
/*    */ @Service
/*    */ public class ChwCustomerService
/*    */   implements IChwCustomerService
/*    */ {
/*    */ 
/*    */   @Autowired
/*    */   private ChwCustomerMapper chwCustomerMapper;
/*    */ 
/*    */   public PageInfo<ChwCustomer> find(ChwCustomer chwCustomer, Integer currentPage, Integer pageSize)
/*    */   {
/* 19 */     PageHelper.startPage(currentPage.intValue(), pageSize.intValue());
/* 20 */     List list = this.chwCustomerMapper.findByChwChwCustomer(chwCustomer);
/* 21 */     return new PageInfo(list);
/*    */   }
/*    */ 
/*    */   public int save(ChwCustomer chwCustomer)
/*    */   {
/*    */     try {
/* 27 */       chwCustomer.setCustomerId(UUIDUtil.getUUID());
/* 28 */       chwCustomer.setLastUpdatedDate(new Date());
/* 29 */       chwCustomer.setCreatedDate(new Date());
/* 30 */       CommonFieldsUtil.setCreateValueByCy(chwCustomer);
/* 31 */       this.chwCustomerMapper.insert(chwCustomer);
/* 32 */       return 0;
/*    */     } catch (Exception e) {
/* 34 */       e.printStackTrace();
/*    */     }
/* 36 */     return 1;
/*    */   }
/*    */ 
/*    */   public int delVendor(String id)
/*    */   {
/*    */     try {
/* 42 */       ChwCustomer chwCustomer = this.chwCustomerMapper.selectByPrimaryKey(id);
/* 43 */       chwCustomer.setEnabledFlag("N");
/* 44 */       this.chwCustomerMapper.updateByPrimaryKey(chwCustomer);
/* 45 */       return 0;
/*    */     } catch (Exception e) {
/* 47 */       e.printStackTrace();
/*    */     }
/* 49 */     return 1;
/*    */   }
/*    */ 
/*    */   public ChwCustomer findById(String id)
/*    */   {
/* 54 */     return this.chwCustomerMapper.selectByPrimaryKey(id);
/*    */   }
/*    */ 
/*    */   public int update(ChwCustomer chwCustomer)
/*    */   {
/*    */     try {
/* 60 */       CommonFieldsUtil.setCreateValueByCy(chwCustomer);
/* 61 */       chwCustomer.setLastUpdatedDate(new Date());
/* 62 */       this.chwCustomerMapper.updateByPrimaryKey(chwCustomer);
/* 63 */       return 0;
/*    */     } catch (Exception e) {
/* 65 */       e.printStackTrace();
/*    */     }
/* 67 */     return 1;
/*    */   }
/*    */ }

/* Location:           E:\chenya\haha\admin java\customer\
 * Qualified Name:     com.chw.admin.customer.ChwCustomerService
 * JD-Core Version:    0.6.0
 */